[#ftl]
[@define "agile._Contained" "_Contained"]
//	_metadata:null/*Map<String,Object>The runtime information of this widget,key is the attribute name, value is the attribute value*/
	parent:null/*parent container*/
//	,preamble:function(params,srcNodeRef){
//		//precursor to constructor; can manipulate superclass constructor args
//		this._metadata = {};
//		console.log(this.declaredClass,"_Contained..preamble..metadata:",this._metadata);
//	}
//	,constructor: function(){
////		if(this._metadata == null){
////			this._metadata = {};	
////		}
////		console.log(this.declaredClass,"agile._Contained[constructor]...",this._metadata);
//	}	
//	,init:function(){
//		////console.log(this.declaredClass,"[agile._Contained]init...");
//	}
	[@method "getPreferredSize"/]
	,getPreferredSize:function(){
		return {w:0,h:0};
	}
	[@method "getToolbarAnchorNode"/]
	,getToolbarAnchorNode:function(){
		return this.domNode;
	}
	//TODO:this method to be removed, use the one in MetadataMinin2
	[@method "metadata"/]
//    ,metadata:function(){
//		////console.log(this.declaredClass,"metadata:function",arguments);
//    	var name = arguments[0];
//		var value = arguments[1];
//		//no parameters
//		if(arguments.length == 0){		
//			return this._metadata;
//		}
//		//only name parameter		
//		if(arguments.length == 1){
//			return agile.getValue(name,this._metadata);
//		}		
//		//both parameters		
//		if(name == "style.left" || name == "style.top" || name == "style.width" || name == "style.height"){
//			if(value == null){
//				
//			}else if(typeof value == "number"){
//				
//			}else if(typeof value == "string"){
//				value = parseFloat(value.replace("px",""));	
//			}
//			if(value == null){
//				agile.setValue(name,null,this._metadata);
//			}else{
//				agile.setValue(name,value+"px",this._metadata);
//			}
//			this.dimension[name.replace("style.","")] = value;
//		}else{
//			agile.setValue(name,value,this._metadata);
//			if(name == "moveable" && this.moveableWidget){
//				this.moveableWidget.delay = value?0:1000;
//			}
//		}
//	}
	,moveLayer:function(direction){
		switch(direction){
		case "back":
			if(--this.parent.childMinZIndex < 1){
				this.parent.childMinZIndex = 1;
			}
			this.style1("z-index",this.parent.childMinZIndex);			
			break;
		case "front":
			this.style1("z-index",++this.parent.childMaxZIndex);
			break;
		case "backwards":
			var idx = this.style1("z-index");
			if(--idx <= 1){
				this.parent.childMinZIndex = idx = 1;
			}
			this.style1("z-index",idx);
			break;
		case "forwards":
			var idx = this.style1("z-index");
			if(++idx > this.parent.childMaxZIndex){
				this.parent.childMaxZIndex = idx;
			}
			this.style1("z-index",idx);
			break;
		}
	}
[/@]
